Skip to content

Native multiarch support with backwards compatibility to osrf images#1120

Open
Crola1702 wants to merge 15 commits intomasterfrom
Crola1702/multiarch-support
Open

Native multiarch support with backwards compatibility to osrf images#1120
Crola1702 wants to merge 15 commits intomasterfrom
Crola1702/multiarch-support

Conversation

@Crola1702
Copy link
Contributor

No description provided.

Signed-off-by: Crola1702 <cristobal.arroyo@ekumenlabs.com>
Signed-off-by: Crola1702 <cristobal.arroyo@ekumenlabs.com>
Signed-off-by: Crola1702 <cristobal.arroyo@ekumenlabs.com>
Signed-off-by: Crola1702 <cristobal.arroyo@ekumenlabs.com>
Comment on lines +28 to +29
if base_image.startswith('arm64v8/'):
platform_flag = 'linux/arm64'
Copy link
Contributor

@claraberendsen claraberendsen Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this flag even if the image is already targeting the correct architecture?
I believe docker should be able to fetch the correct image based on the host OS.
If you do docker run -it ubuntu:noble uname -m it will automatically download the correct image if we are not doing cross-compilation.

@claraberendsen
Copy link
Contributor

For the transition to using the native multi arch docker images the main things we should provide are:

  • Use the correct docker image for the base OS when we are not using qemu. That should be as simple as fetching the ubuntu:noble image from the correct agent.
  • Allow backwards compatibility for the older images noble and before. That should be a flag that could be --legacy-multi-arch or something as to have a path to what was working.
  • For resolute onward use the native docker --platform to signal that we want to emulate the other architecture. If qemu is already installed and configured properly on the host --platform should suffice to indicate.

I think is a topic of discussion if we want this to be a flag the user has to set for the job to use emulation or if we want ros_buildfarm to work smarter and detect the arch drift and set the correct docker args.

add_argument_dockerfile_dir(parser)
add_argument_env_vars(parser)
add_argument_skip_tests(parser)
parser.add_argument(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should invert this argument and set the new way as default with a specific argument to fallback to the previous ways.

if arch in ['i386', 'armhf', 'arm64'] and not vars().get('use_official_docker_images', False):
base_image = 'osrf/%s_%s:%s' % (os_name, arch, os_code_name)
elif arch == 'arm64' and vars().get('use_official_docker_images', False):
base_image = 'arm64v8/%s:%s' % (os_name, os_code_name)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though this naming is correct I think it's unnecessary since in modern docker the architecture resolution is done based on the image pull.

Signed-off-by: Crola1702 <cristobal.arroyo@ekumenlabs.com>
Partially generated using Gemini 3.0 Pro

Signed-off-by: Crola1702 <cristobal.arroyo@ekumenlabs.com>
@Crola1702
Copy link
Contributor Author

So, with the last changes, I have the following results for amd and arm

amd64 (my workstation)

Running:

python3 -m ros_buildfarm.scripts.release.generate_release_script https://raw.githubusercontent.com/ros2/ros_buildfarm_config/refs/heads/ros2/index.yaml rolling default ament_package ubuntu noble amd64 > amd64_job.sh

amd64_job.sh
amd64_build_log.txt

arm64 (testfarm agent)

Running:

python3 -m ros_buildfarm.scripts.release.generate_release_script https://raw.githubusercontent.com/ros2/ros_buildfarm_config/refs/heads/ros2/index.yaml rolling unv8 ament_package ubuntu noble arm64 > arm64_job.sh

arm64_job.sh
arm64_build_log.txt

Note in job.sh that ros_buildfarm generates --platform=linux/arm64 but also --platform=linux/armv8. Not completely sure why, but it seemed to work, as you can see in the build_log.

What I think I'm missing is the possibility of using osrf/ubuntu_{arch}:noble images.

I added --docker-image-prefix, so we can do something like osrf/ubuntu:noble instead. However, I'm not sure how to put the architecture in-between, as using --docker-image-prefix osrf/ubuntu_arm64: results in osrf/ubuntu_arm64:ubuntu:noble image 🤔

Looking for another review and ideas now @cottsay @claraberendsen

@Crola1702
Copy link
Contributor Author

Crola1702 commented Feb 10, 2026

@claraberendsen suggestion:

  • --docker-image-prefix is os_code by default. So --docker-image-prefix is actually the whole image.
  • To keep in mind: in buildfarm_tools_config we should specify --docker-image-prefix osrf/ubuntu_{arch} so that we keep backwards compatibility
  • We should configure a job in the test farm to check if everything is working correctly

Maybe we can do instead (as we're not actually doing a prefix, but the image without the tag):

- --docker-image-prefix
+ --docker-image

Signed-off-by: Crola1702 <cristobal.arroyo@ekumenlabs.com>
Signed-off-by: Crola1702 <cristobal.arroyo@ekumenlabs.com>
@Crola1702
Copy link
Contributor Author

With the current changes now running:

python3 -m ros_buildfarm.scripts.release.generate_release_script https://raw.githubusercontent.com/ros2/ros_buildfarm_config/refs/heads/ros2/index.yaml rolling unv8 ament_package ubuntu noble arm64 --docker-image-prefix osrf/ubuntu_arm64 > job.sh

arm64_job.sh
arm64_build_log.txt

@Crola1702 Crola1702 marked this pull request as ready for review February 11, 2026 13:47
@Crola1702 Crola1702 changed the title [WIP] Multiarch support Native multiarch support with backwards compatibility Feb 11, 2026
@Crola1702 Crola1702 changed the title Native multiarch support with backwards compatibility Native multiarch support with backwards compatibility to osrf images Feb 11, 2026
Signed-off-by: Crola1702 <cristobal.arroyo@ekumenlabs.com>
Signed-off-by: Crola1702 <cristobal.arroyo@ekumenlabs.com>
Signed-off-by: Crola1702 <cristobal.arroyo@ekumenlabs.com>
Co-authored-by: Scott K Logan <logans@cottsay.net>
Signed-off-by: Crola1702 <cristobal.arroyo@ekumenlabs.com>
Signed-off-by: Crola1702 <cristobal.arroyo@ekumenlabs.com>
@Crola1702 Crola1702 requested a review from cottsay February 19, 2026 15:08
Signed-off-by: Crola1702 <cristobal.arroyo@ekumenlabs.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants